<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNotificationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('notifications', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->comment('=user.id');
            $table->integer('type')->comment('1:公告2:通知3:点赞');
            $table->text('data')->comment('消息内容');
            $table->integer('create_id')->comment('创建人id');
            $table->timestamp('read_at')->nullable();
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `notifications` comment '消息通知表';");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('notifications');
    }
}
